<template>
  <h1>单选组件</h1>
  <el-radio-group v-model="radio">
    <el-radio label="学历:高中" value="高中"></el-radio>
    <el-radio label="学历:大专" value="大专"></el-radio>
    <el-radio label="学历:本科" value="本科"></el-radio>
    <el-radio label="学历:硕士" value="硕士"></el-radio>
  </el-radio-group>
  <h4>你选择的学历是：{{ radio }}</h4>
  <hr>
  <el-radio-group v-model="selectProduct">
    <el-radio v-for="i in products" :label="i.name" :value="i"></el-radio>
  </el-radio-group>
  <h4>你选择的产品是：{{selectProduct.price}}</h4>
</template>

<script setup>
import {ref} from "vue";

let radio = ref("");
let products = ref([
  {
    name: "iPhone",
    price: 10000
  },
  {
    name: "iPad",
    price: 20000
  },
  {
    name: "iMac",
    price: 30000
  }
]);
let selectProduct = ref({
  name: '',
  price: ''
});
</script>

<style scoped>

</style>